Skip to content

Allow threads to run in the background#812

Open
AbhinRustagi wants to merge 19 commits into
mainfrom
ar-background-runs-on-switch
Open

Allow threads to run in the background#812
AbhinRustagi wants to merge 19 commits into
mainfrom
ar-background-runs-on-switch

Conversation

@AbhinRustagi

@AbhinRustagi AbhinRustagi commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Issue: Currently if an assistant is streaming a request in a thread, and the user switches the chat, the request is aborted and abandoned - bad UX.

Implemented solve:

  1. Update the store to supports multiple ThreadState
  2. Added isCreatingThread guard: When you send the first message in a brand-new chat, processMessage runs under DRAFT_KEY and then awaits createThread to get a real thread id. During that brief window, the draft slot is "owned" by that in-flight run. If you hit New Chat again during that window, switchToNewThread would clear/reset DRAFT_KEY.
  3. Added a check to show a loader when a request moves to background as the user switches to another thread.
  4. Implemented LRU Cache for thread memory management

@AbhinRustagi
AbhinRustagi marked this pull request as ready for review July 23, 2026 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant